<template>
  <div class="processBox">
    <div class="timeImgDiv">
      <img src="../../assets/img/time.png" />
    </div>
    <div class="timelineProcessBox">
      <el-timeline class="timeline">
        <el-timeline-item class="lineitem" :class="activity.done ? 'active' : 'inactive'"
          v-for="(activity, index) in activities" :key="index" :timestamp="activity.time">
        </el-timeline-item>
      </el-timeline>
    </div>
  </div>
</template>

<script setup lang='ts'>
const activities = [
  {
    time: '10:25',
    done: true,
  },
  {
    time: '10:26',
    done: true,
  },
  {
    time: '10:27',
    done: true,
  },
  {
    time: '10:28',
    done: true,
  },
  {
    time: '10:29',
    done: true,
  },
  {
    time: '10:30',
    done: false,
  },
  {
    time: '10:31',
    done: false,
  },
  {
    time: '10:32',
    done: false,
  },
  {
    time: '10:33',
    done: false,
  },
  {
    time: '10:34',
    done: false,
  },
  {
    time: '10:35',
    done: false,
  },
]
</script>

<style lang="less" scoped>
.processBox {
  background-color: transparent;
  width: 100%;
  height: 100%;
  padding: 20px 0 0 0;
  box-sizing: border-box;
  display: flex;

  .timeImgDiv {
    width: 2vw;
    height: 2vw;
    margin: 0 10px;

    img {
      width: 100%;
      height: 100%;
    }
  }

  .timelineProcessBox {
    flex: 1;

    .timeline {
      display: flex;
      width: 100%;
      margin: 0;
      padding: 0 0 0 10px;
      box-sizing: border-box;

      .lineitem {
        // transform: translateX(50%);
        width: 11%;
      }
    }
  }
}

:deep(.el-timeline-item__tail) {
  border-left: none;
  border-top: 2px solid #e4e7ed;
  width: 100%;
  position: absolute;
  top: 6px;
}

:deep(.el-timeline-item__wrapper) {
  padding-left: 0;
  position: absolute;
  top: 10px;
  // transform: translateX(-50%);
  text-align: center;
}

:deep(.el-timeline-item__timestamp) {
  font-size: 14px;
}

.active {
  :deep(.el-timeline-item__node) {
    background-color: #fff;
  }

  :deep(.el-timeline-item__tail) {
    border-color: #0668f2;
  }
}

// 有active样式的下一个li
.active+li {
  :deep(.el-timeline-item__node) {
    background-color: #0668f2;
  }
}

.timeline>.active:first-child {
  :deep(.el-timeline-item__node) {
    background-color: #0668f2;
  }
}
</style>